package com.lk.netty.initializer;

import com.lk.netty.handler.ProxyToServerHandler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class ProxyToServerIniializer extends ChannelInitializer<SocketChannel> {

    private final Channel inboundChannel;

    public ProxyToServerIniializer(Channel inboundChannel) {
        this.inboundChannel = inboundChannel;
    }

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new ProxyToServerHandler(inboundChannel));
    }
}
